//index.js
//获取应用实例
const app = getApp()

var routes = require('./routes.js');

Page({
  data: {
  },

  onLoad: function (options) {
  
  },

  onReady: function () {
    // Do something when page ready.
  },
  onShow: function () {
    if (app.isLogined == false) {
      wx.showToast({
        title: '请先授权登录',
      });
     
      setTimeout(()=>{
        wx.switchTab({
          url: '../tab2/index',
        })
      } ,1000);
    }

       this.setData(
         {
           userInfoInWX: app.userInfoInWX,
           userInfoInXZS: app.userInfoInXZS,
           shopInfo: app.shopInfo
         }
       );

       wx.setNavigationBarTitle({
         title: app.shopInfo.name,
         success: function (res) {
         }
       })

  },
  onHide: function () {
    // Do something when page hide.
  },
  onUnload: function () {
    // Do something when page close.
  },
  makeCall:function(){
    let that = this;
    wx.makePhoneCall({
      phoneNumber: that.data.shopInfo.tel  //仅为示例，并非真实的电话号码
    })
  },
headLoadError:function(e){
  console.log(e);
}

})